import { useState } from "react";
import {
  AtNoticebar,
  AtTabs,
  AtTabsPane,
  AtNavBar,
  AtFab,
  AtIcon,
  AtFloatLayout,
  AtTabBar
} from "taro-ui";
import { Swiper, SwiperItem, View, Image, Button } from "@tarojs/components";
import Taro from '@tarojs/taro'
import Content_1 from "./content/content";


import Forum from "../../components/forum/forum";
import "./postBar.scss";
import headPortrait from "./img/headPortrait.png";
import issImg from "./img/issImg.jpg";
import share from "./img/share.png";
import comment from "./img/comment.png";
import like from "./img/like.png";
import NavBar from "../../components/topbar/topbar";
import Content from "./comments/content";


// const [isOpend,setOpen] = useState(false)

function postBar() {
  const [current, setCurrent] = useState(0);
  const [isOpen, setOpen] = useState(false);
  const [isRight, setRight] = useState(true);
  const handleClick = (value) => {
    setCurrent(value);
  };
  
  const changeOpen = () => {
    setOpen(true)
  }
  const changeRight = () => {
    setRight(!isRight)
  }
  const toBack = () => {
    Taro.navigateBack().then();
  }
  const toHome = () => {
    Taro.redirectTo({ url: "/pages/firstPage/firstPage" }).then();
  }


  const handleClick3 = () => {
    Taro.navigateTo({
      url: '/pages/details/shareCard/shareCard'
    })
  }
  const handleClick4 = () => {
    Taro.navigateTo({
      url: '/pages/postBar/comment/comment',
    });
  };
  const handleClick5 = () => {
    Taro.navigateTo({
      url: '/pages/postBar/comments/comments',
    });
  };

  return (
    <View>
      {/* 标题栏 */}
      <View className="nav">
        <NavBar
          // onClick={handleClick2}
          color="#000"
          title="贴吧"
          back={true}
          nback={toBack}
          home={true}
          onHome={toHome}
        />
      </View>
      <AtNoticebar marquee={true}>友善评论，文明发言</AtNoticebar>
      
      {/* 标签页 */}
      <AtTabs
        current={current}
        scroll
        tabList={[
          { title: "热帖" },
          { title: "最新回复" },
          { title: "最新发帖" },
          { title: "求助" }
        ]}
        onClick={res => {
          handleClick(res);
        }}
      >
        <AtTabsPane current={current} index={0}>
          {/* 组件传入 */}
          <Forum />
        </AtTabsPane>

        <AtTabsPane current={current} index={1}>
          <Forum />
        </AtTabsPane>

        <AtTabsPane current={current} index={2}>
          <Forum />
        </AtTabsPane>
        <AtTabsPane current={current} index={3}>
          <Forum />
        </AtTabsPane>
      </AtTabs>

      {/* 发布 */}
      <View>
        <AtTabBar
          className="issue"
          fixed
          color="#fbcebe"
          tabList={[{ title: "发布", iconType: "edit" }]}
          onClick={handleClick5}
          current={current}
        />
      </View>
    </View>
  );
}
export default postBar;
